﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ODP.Com;
using ODP.Enum;
using ODP.Model;

namespace ODP.SinaAPI
{
    public class SinaOAuth : OAuthBase
    {
        public SinaOAuth()
        {

            this.twitterType = TwitterType.Sina;
            this.baseurl = "https://api.weibo.com/2/";
            this.Access_token_url = "http://api.weibo.com/oauth2/access_token";
            this.Request_token_url = "https://api.weibo.com/oauth2/authorize";
            this.customKey = "2159118604";
            this.customSecret = "43af6a039a41e30b93c12b0cb4169429";
            this.callbackUrl = "http://www.baidu.com";
            InitApiInfoList();

        }
        public SinaOAuth(OAuthBase OAuth)
        {
            this.callbackUrl = OAuth.callbackUrl;
            this.Charset = OAuth.Charset;
            this.customKey = OAuth.customKey;
            this.customSecret = OAuth.customSecret;
            this.tokenKey = OAuth.tokenKey;
            this.tokenSecret = OAuth.tokenSecret;
            this.twitterType = TwitterType.Sina;
            this.verify = OAuth.verify;
            this.baseurl = "https://api.weibo.com/2/";
            this.Access_token_url = "http://api.weibo.com/oauth2/access_token";
            this.Request_token_url = "https://api.weibo.com/oauth2/authorize";
            this.callbackUrl = "http://www.baidu.com";
            this.customKey = "1768384722";
            this.customSecret = "c6d96ecf1794da33ad66c4925befd084";
            InitApiInfoList();
        }

        void InitApiInfoList()
        {
            apiInfoList = new List<APIInfo>();
            //主页
            apiInfoList.Add(new APIInfo("GetHomePage", "statuses/home_timeline", HttpMethod.GET));

            //转播
            apiInfoList.Add(new APIInfo("Forward", "statuses/repost", HttpMethod.POST));

            //获取他人的相关信息
            apiInfoList.Add(new APIInfo("GetOtherUserInfo", "users/show.json", HttpMethod.GET));
            //评论
            apiInfoList.Add(new APIInfo("Reply", "comments/reply", HttpMethod.POST));
            //发布新的微博消息
            apiInfoList.Add(new APIInfo("WeiBoAdd", "statuses/update", HttpMethod.POST));
            //发布带图片的微博消息
            apiInfoList.Add(new APIInfo("WeiBoAddWithPic", "statuses/upload_url_text", HttpMethod.POST));
            //获取当前登陆用户的信息
            apiInfoList.Add(new APIInfo("GetCurrentUserInfo", "users/show.json", HttpMethod.GET));
            //关注一个用户
            apiInfoList.Add(new APIInfo("AddFriends", "friendships/create.json", HttpMethod.POST));

            apiInfoList.Add(new APIInfo("AddSpecialFriends", "friends/addspecial", HttpMethod.POST));

            apiInfoList.Add(new APIInfo("InviteFriends", "invite/event_invite", HttpMethod.GET));
            //获取别人的粉丝
            apiInfoList.Add(new APIInfo("GetOtherUserFans", "friendships/followers", HttpMethod.GET));
            //获取特殊的粉丝
            apiInfoList.Add(new APIInfo("GetOtherUserSpecialFans", "friends/user_speciallist", HttpMethod.GET));
            //其他帐户收听的人列表
            apiInfoList.Add(new APIInfo("GetOtherUserIdol", "friends/user_idollist", HttpMethod.GET));
            //当前帐户的粉丝列表
            apiInfoList.Add(new APIInfo("GetCurrentUserFans", "friends/fanslist_s", HttpMethod.GET));
            //当前帐户的听众列表
            apiInfoList.Add(new APIInfo("GetCurrentUserIdol", "friends/idollist_s", HttpMethod.GET));
            //获取当前用户可能感兴趣的用户
            apiInfoList.Add(new APIInfo("GetMayKownPerson", "suggestions/users/may_interested.json", HttpMethod.GET));
            //获取系统推荐用户
            apiInfoList.Add(new APIInfo("GetHotPerson", "suggestions/users/hot.json", HttpMethod.GET));
            //根据内容获取推荐用户
            apiInfoList.Add(new APIInfo("GetMayKownPersonByContent", "suggestions/users/by_status.json", HttpMethod.GET));

            //发表回复
            apiInfoList.Add(new APIInfo("RePost", "statuses/repost.json", HttpMethod.POST));

            //对一条微博进行评论
            apiInfoList.Add(new APIInfo("AddComment", "comments/create.json", HttpMethod.POST));
             
        }
    }
}
